package cn.wgx.module.mind.websocket.entity;

import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;

import java.util.HashMap;
import java.util.UUID;

@Data
public class BaseMessage {

    public BaseMessage(){    }

    public BaseMessage(WSPrincipal wsPrincipal){ this.fromUser=wsPrincipal;   }

    //基本参数
    protected String id = UUID.randomUUID().toString().replace("-", "");
    protected String content;
    protected MessageType msgType = MessageType.TEXT;
    protected String toUser;
    protected WSPrincipal fromUser;
    @JsonIgnore
    protected String sessionId;
    protected Object data = new HashMap<>();

    //房间参数
    protected String roomId;

    //编剧平台参数
    private Integer beat_id;


    public String toJSONOString(){
        return JSON.toJSONString(this);
    }

}
